package com.example.remword;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author jie
 * @date 2021/4/17 -20:18
 */
@Mapper
public interface RememberWordMapper {
    @Select("select * from word ")
    List<Word> selectAll();

    @Insert("<script>" +
            "insert into word (word_en,word_cn) " +
            "values " +
            "<foreach collection='wordList' item='word' index='index' separator=','>" +
            "(#{word.wordEn}, #{word.wordCn})" +
            "</foreach>" +
            "</script>")
    void addBatch(@Param("wordList") List<Word> wordList);
}
